//
//  FingerprintViewController.m
//  Diary
//
//  Created by lanou3g on 15/12/20.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "FingerprintViewController.h"
#import <LocalAuthentication/LocalAuthentication.h>
#import "DiaryViewController.h"
#import "MoodViewController.h"
@interface FingerprintViewController ()

@end

@implementation FingerprintViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if ([UIDevice currentDevice].systemVersion.floatValue < 8.0) {
       
        return ;
    }
    
    LAContext *ctx = [[LAContext alloc] init];
    
    // 判断设备是否支持指纹识别
    if ([ctx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:NULL]) {
        
        // 输入指纹，异步
        // 提示：指纹识别只是判断当前用户是否是手机的主人！程序原本的逻辑不会受到任何的干扰！
        [ctx evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"指纹登录" reply:^(BOOL success, NSError *error) {
           
            
            if (success==YES) {
                // 登录成功
                // TODO
                
                
                
            }
        }];
        
        NSLog(@"come here");
    } else {
       
    }
    

       
    
}



@end
